
class FileHelper:
    """文件帮助类"""
    file_name = 'PID'

    @staticmethod
    def create(name, value):
        f=open(name, 'w')
        f.write(value)
        f.close()

    @staticmethod
    def read(name):
        file_object = open(name)
        try:
            all_the_text = file_object.read()
            return all_the_text
        finally:
            file_object.close()

    @staticmethod
    def readLines(name):
        file_object = open(name)
        try:
            all_the_line = file_object.readlines()
            return all_the_line
        finally:
            file_object.close()

    @staticmethod
    def record_pid(pid):
        FileHelper.create(FileHelper.file_name, pid)